'''
Created on Apr 18, 2011

@author: srikanth_nukala
'''
import os
import Image

path="C:\\Documents and Settings\\nukala_srikanth\\Desktop\\images_bkup\\images"  # insert the path to the directory of interesthere
thumbpath="C:\\Documents and Settings\\nukala_srikanth\\Desktop\\images_bkup\\thumbs"
 
dirList=os.listdir(path)
for fname in dirList:
    try:
        im = Image.open(path+'\\'+fname)
    except:
        print fname;
        exit;        
    if im.size[0] > 600:        
        print 'greater than 700 ::'+fname+" width:"+str(im.size[0])
        im.thumbnail([(im.size[0]*2/3),(im.size[1]*2/3)])
        im.save(thumbpath+'\\'+fname)
        
        

